﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using QxFramework.Core;

public class BaseLine : EffectBase
{
    string followItemName = default;
    private GameObject t;
    private float angle;
    private float FinalAngle;


    public override void OnDisplay(Vector3 pos, object arg = null)
    {
        base.OnDisplay(pos, arg);
        var info = arg as Tuple<string, float, float>;
        this.transform.localScale = Vector3.one * info.Item2;
        followItemName = info.Item1;
        angle = info.Item3;
    }
    public void OnEnable()
    {
        if (ClockManager.Get<IItemSyncManager>().GetGameObjectByName(followItemName) != null)
        {
            t = ClockManager.Get<IItemSyncManager>().GetGameObjectByName(followItemName);
            this.transform.position = t.transform.position;
            this.transform.rotation = t.transform.rotation;
        }
    }

    public void FixedUpdate()
    {
        transform.localEulerAngles = new Vector3(0, 0, angle);
    }
}